import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';

export const columns : BasicColumn[] = [
  {
    title: '产品模型ID',
    dataIndex: 'productModelId'
  },
  {
    title: '产品ID',
    dataIndex: 'productId'
  },
  {
    title: '模型ID',
    dataIndex: 'modelId'
  },
  {
    title: '删除标识',
    dataIndex: 'delFlag'
  },
];

export const searchFormSchema : FormSchema[] = [
  {
    label: '产品模型ID',
    field: 'productModelId',
    component: 'InputNumber'
  },
  {
    label: '产品ID',
    field: 'productId',
    component: 'InputNumber'
  },
];

export const formSchema : FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: '', field: 'id', component: 'Input', show: false },
  { label: '', field: 'isEdit', component: 'InputNumber', show: false },
  {
    label: '产品模型ID',
    field: 'productModelId',
    component: 'InputNumber',
    rules: [{ required: true, message: "请输入产品模型ID" }],
    dynamicDisabled: ({ values }) => {
      if (values.isEdit != undefined && values.isEdit == true) {
        return true
      } else {
        return false
      }
    },
  },
  {
    label: '产品ID',
    field: 'productId',
    component: 'InputNumber',
    rules: [{ required: true, message: "请输入产品ID" }],
    dynamicDisabled: ({ values }) => {
      if (values.isEdit != undefined && values.isEdit == true) {
        return true
      } else {
        return false
      }
    },
  },
  {
    label: '模型ID',
    field: 'modelId',
    component: 'InputNumber',
    rules: [{ required: true, message: "请输入模型ID" }],
    dynamicDisabled: ({ values }) => {
      if (values.isEdit != undefined && values.isEdit == true) {
        return true
      } else {
        return false
      }
    },
  }
];
